package promotion

import (
	"github.com/flaravel/quanlaolao/app/models"
)

type GroupPromotion struct {
	models.BaseModel
	Name 	 			string `gorm:"type:varchar(255);not null;comment:'群名称'" valid:"name" json:"name"`
	Avatar  			string `gorm:"type:varchar(255);not null;comment:'群头像图片'" valid:"avatar" json:"avatar"`
	WechatQrCode  	 	string `gorm:"type:varchar(255);not null;comment:'群主微信二维码图片'" valid:"wechat_qrcode" json:"wechat_qr_code"`
	Desc		 		string `gorm:"type:varchar(255);not null;comment:'群裂变导语'" valid:"desc" json:"desc"`
	Url	 	    		string `gorm:"type:varchar(255);not null;comment:'群扫码链接'" json:"url"`
	Number  	 		int     `gorm:"not null;comment:'群人数'" valid:"number" json:"number"`
	UrlQrCode  	 		string  `gorm:"not null;comment:'群链接二维码'" json:"url_qr_code"`
	GroupAvatars        []GroupAvatar `gorm:"foreignKey:GroupId" json:"group_avatars"`
	GroupContents       []GroupContent `gorm:"foreignKey:GroupId" json:"group_contents"`
}

type GroupAvatar struct {
	models.BaseModel
	Avatar    string `gorm:"type:varchar(150);not null;comment:'聊天头像'" valid:"avatar" json:"avatar"`
	GroupId   uint64 `gorm:"not null;comment:'群裂变ID'" valid:"group_id" json:"-"`
}

type GroupContent struct {
	models.BaseModel
	Content   string `gorm:"type:varchar(500);not null;comment:'聊天内容'" valid:"content" json:"content"`
	IsRight   int `gorm:"type:tinyint;not null;comment:'是否右侧 1-是 0-否'" valid:"is_right" json:"is_right"`
	GroupId   uint64 `gorm:"not null;comment:'群裂变ID'" valid:"group_id" json:"-"` 
}